<template>
  <div id="app">
    <!-- 全局导航栏 - 根据路由meta.hideNavigation决定是否显示 -->
    <GlobalNavigation v-if="!shouldHideNavigation" />
    
    <div class="transition-transform duration-300" :class="aiAssistantOpen ? '-translate-x-1/4' : ''">
      <router-view />
    </div>
    
    <!-- 全局底部导航 - 根据路由meta.hideNavigation决定是否显示 -->
    <GlobalFooter v-if="!shouldHideNavigation" />
    
    <!-- 全局AI助教组件 -->
    <AIAssistant v-if="!shouldHideNavigation" @toggle="handleAIToggle" />
    
    <!-- 全局消息通知组件 -->
    <MessageNotification v-if="!shouldHideNavigation" />
  </div>
</template>

<script setup>
import { ref, computed } from 'vue'
import { useRoute } from 'vue-router'
import AIAssistant from './components/AIAssistant.vue'
import GlobalNavigation from './components/GlobalNavigation.vue'
import GlobalFooter from './components/GlobalFooter.vue'
import MessageNotification from './components/MessageNotification.vue'

// 主应用组件，使用路由视图
const aiAssistantOpen = ref(false)
const route = useRoute()

// 根据当前路由的meta.hideNavigation决定是否隐藏导航栏和页脚
const shouldHideNavigation = computed(() => {
  return route.meta?.hideNavigation === true
})

const handleAIToggle = (isOpen) => {
  aiAssistantOpen.value = isOpen
}
</script>

<style>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
}

#app {
  height: 100vh;
  width: 100vw;
}

/* Element Plus 全局样式覆盖 */
.el-button--primary {
  --el-button-bg-color: #3b82f6;
  --el-button-border-color: #3b82f6;
  --el-button-hover-bg-color: #2563eb;
  --el-button-hover-border-color: #2563eb;
  --el-button-active-bg-color: #1d4ed8;
  --el-button-active-border-color: #1d4ed8;
}

.el-link--primary {
  --el-link-text-color: #3b82f6;
  --el-link-hover-text-color: #2563eb;
}

.el-checkbox__input.is-checked .el-checkbox__inner {
  background-color: #3b82f6;
  border-color: #3b82f6;
}

.el-radio__input.is-checked .el-radio__inner {
  background-color: #3b82f6;
  border-color: #3b82f6;
}

.el-input__wrapper.is-focus {
  box-shadow: 0 0 0 1px #3b82f6 inset;
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.3);
  border-radius: 4px;
  transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(59, 130, 246, 0.5);
}
</style>